﻿using Microsoft.AspNetCore.Mvc;

namespace AspDotNet.Core6.WebApi.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class SendJsonController : ControllerBase
    {

        [HttpGet]
        [Produces("application/json")]
        public object GetJsonByProduces()
        {
            return new[]
            {
                new
                {
                    result=true,
                    date=DateTime.Now
                }
            }.ToList();
        }

        [HttpGet("{id}")]
        [Produces("application/json")]
        public IEnumerable<object> GetF(int id)
        {
            return Enumerable.Range(1, 5).Select(index => new
            {
                Date = DateTime.Now.AddDays(index),
                TemperatureC = Random.Shared.Next(-20, 55),
                Summary = id
            })
            .ToArray();
        }
    }

}
